package tech.xs.sys.domain.bo.config;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import tech.xs.common.framework.domain.bo.PageBo;
import tech.xs.common.framework.domain.entity.BaseEntity;
import tech.xs.sys.domain.entity.SysConfig;

@Getter
@Setter
@ToString
public class PageConfigBo extends PageBo<SysConfig> {

    /**
     * 编码
     */
    private String likeCode;

    /**
     * 名称
     */
    private String lickName;

    /**
     * 配置值
     */
    private String likeData;

    /**
     * 备注
     */
    private String likeRemark;

    public LambdaQueryWrapper<SysConfig> query() {
        return Wrappers.<SysConfig>lambdaQuery()
                .like(StrUtil.isNotBlank(likeCode), SysConfig::getCode, likeCode)
                .like(StrUtil.isNotBlank(lickName), SysConfig::getName, lickName)
                .like(StrUtil.isNotBlank(likeData), SysConfig::getData, likeData)
                .like(StrUtil.isNotBlank(likeRemark), SysConfig::getRemark, likeRemark)
                .orderByDesc(BaseEntity::getCreatedTime);
    }

}
